home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!hpl3sn03.cern.ch
- From: Dan Pop <danpop@mail.cern.ch>
- Newsgroups: comp.lang.c
- Subject: Re: HELP - why isn't ld working
- Date: Fri, 2 Feb 1996 19:06:17 +0100
- Organization: CERN European Lab for Particle Physics
- Message-ID: <9602021806.AA29085@dxmint.cern.ch>
- References: <4etai7$22s@deadbird.db.erau.edu>
- X-NNTP-Posting-Host: hpl3sn03.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
- X-Mail2News-Path: dxmint.cern.ch!hpl3sn03.cern.ch
-
- marseed@news.db.erau.edu (Darryl E. Marsee) writes:
-
- >Under Solaris 2.4, SunOS 4.1.4, and AIX 4.1.3 if he does the following:
- >
- > gcc ex5.c ex5a.c
- >
- >It produces a correctly executing a.out. So far so good.
- >
- >Again under all three operating systems, if he does the following instead:
- >
- > gcc -c ex5.c
- > gcc -c ex5a.c
- >
- >Everything compiles fine. However, if he then tries to link them to
- >produce an executable with the following:
- >
- > ld ex5.o ex5a.o -lc
- >
- >On Solaris 2.4 it produces a working a.out, but on SunOS 4.1.4 it produces
- >an a.out that core dumps with a segmentation fault, and on AIX 4.1.3 it
- >produces nothing but gives the error message
- >
- > ld: 0711-327 WARNING: Entry point not found: __start
- > ld: 0711-244 ERROR: No csects or exported symbols have been saved.
-
- The mistake is in using ld. The correct way to link object files produced
- by gcc is:
-
- gcc ex5.o ex5a.o
-
- gcc will produce the magic ld incantation needed to correctly link the
- object files and produce an executable file on the underlying platform.
- Use the -v option with the above command to see how this incantation looks
- and you'll understand why the simple-minded ld invocation didn't work.
-
- >I'm not a C programmer, so I don't have much of a clue what's going on here.
-
- Even if you aren't a C programmer you should have realized that this isn't
- a C language issue and posting to c.l.c was a mistake. A better place
- would have been comp.unix.programmer.
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-